﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        //espa;ol
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            instalacion();
        }
        //ingles
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            instalacion(false);
        }

        private void instalacion(bool espa = true)
        {
            this.Hide();
            var ruta = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\";
            ruta += @"setup.exe";
            var param = @"/configure ";
            if (espa)
            {
                param += "es.xml";
            }
            else
            {
                param += "en.xml";
            }
            try
            {


                System.Diagnostics.Process.Start(ruta, param);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString() + " - " + ruta + param);
            }
            finally
            {
                cerrar();
            }

        }

        private void cerrar()
        {

            MessageBox.Show("La instalación de Office ha iniciado. Al presionar OK se cerrará esta aplicación y la instalación continuará");
            this.Close();
        }
    }
}
